import http from '/@/utils/http';

/**
 * 角色配置api接口集合
 * @method addRole 新增角色
 * @method editRole 编辑角色
 * @method deleteRole 删除角色
 * @method menuTreeList 菜单树列表（设置权限用）
 * @method setRight 角色功能权限配置
 * @method getModuleList 获取模块列表
 * @method getModuleRight 根据角色获取数据查看权限
 * @method setModuleRight 设置数据查看权限
 */
export const addRole = async (params: any) => {
  return await http.post(`/user/mobile/sysRoleInfo/addRole`, params)
}

export const editRole = async (params: any) => {
  return await http.put(`/user/mobile/sysRoleInfo/editRole`, params)
}

export const deleteRole = async (params: any) => {
  return await http.delete(`/user/mobile/sysRoleInfo/deleteRole/${params}`)
}

export const menuTreeList = async (params: any) => {
  return await http.post(`/user/mobile/sysMenuInfo/menuTreeList`, params)
}

export const setRight = async (roleId: any, params: any) => {
  return await http.put(`/user/mobile/sysRoleInfo/setRight/${roleId}`, params)
}

export const getModuleList = async (moduleType: number) => {
  return await http.get(`/system/mobile/sysModuleInfo/getModuleList/${moduleType}`)
}

export const getModuleRight = async (roleId: any) => {
  return await http.get(`/user/mobile/sysRoleInfo/getModuleRight/${roleId}`)
}

export const setModuleRight = async (roleId: any, params: any) => {
  return await http.put(`/user/mobile/sysRoleInfo/setModuleRight/${roleId}`, params)
}

export const deptTreeList = async () => {
  return await http.get(`/user/mobile/sysDeptInfo/deptTreeList`)
}


/**
 * 数据字典api接口集合
 * @method dictionaryList 数据字典列表
 * @method addDictionary 添加字典项
 * @method editDictionary 编辑字典项
 * @method deleteDictionary 删除字典项
 * @method updateSort 修改排序
 * @method deviceModelList 分页查询设备型号列表
 * @method addDeviceModel 添加设备型号
 * @method editDeviceModel 编辑设备型号
 * @method deleteDeviceModel 删除设备型号
 */
export const dictionaryList = async (params: any) => {
  return await http.post(`/system/mobile/sysDataDictionary/dictionaryList`, params)
}

export const addDictionary = async (params: any) => {
  return await http.post(`/system/mobile/sysDataDictionary/addDictionary`, params)
}

export const editDictionary = async (params: any) => {
  return await http.put(`/system/mobile/sysDataDictionary/editDictionary`, params)
}

export const deleteDictionary = async (id: any) => {
  return await http.delete(`/system/mobile/sysDataDictionary/deleteDictionary/${id}`)
}

export const updateSort = async (configType: any, params: any) => {
  return await http.put(`/system/mobile/sysDataDictionary/updateSort/${configType}`, params)
}

export const deviceModelList = async (params: any) => {
  return await http.post(`/device/mobile/deviceModel/deviceModelList`, params)
}

export const addDeviceModel = async (params: any) => {
  return await http.post(`/device/mobile/deviceModel/addDeviceModel`, params)
}

export const editDeviceModel = async (params: any) => {
  return await http.put(`/device/mobile/deviceModel/editDeviceModel`, params)
}

export const deleteDeviceModel = async (id: any) => {
  return await http.delete(`/device/mobile/deviceModel/deleteDeviceModel/${id}`)
}